<html>
<head>

<script id='vertex' type='x-shader/x-vertex'>
attribute vec2 aCoord;
attribute vec2 aTexCoord;
varying vec2 vCoord;

void main() {
  gl_Position = vec4(aCoord, 0.0, 1.0);
  vCoord = aTexCoord;
}
</script>

<script id='fragment' type='x-shader/x-fragment'>
precision mediump float;
varying vec2 vCoord;
uniform sampler2D uTexture;
uniform float uMirror;

void main() {
  vec2 coord = mod(vCoord, vec2(1.0, 1.0));
  if (uMirror != 0.0)
    coord = vec2(1.0 - coord.x, coord.y);
  gl_FragColor = vec4(texture2D(uTexture, coord).rgb, 1.0);
}
</script>

</head>
</html>
